/**
 *
 */
package cn.jobstart.common.format;

import org.springframework.beans.propertyeditors.PropertiesEditor;

public class IntEditor extends PropertiesEditor {
    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if (text == null || ("").equalsIgnoreCase(text) || "null".equalsIgnoreCase(text)) {
            text = "0";
        }
        setValue(Integer.parseInt(text));
    }

    @Override
    public String getAsText() {
        return getValue().toString();
    }
}
